﻿using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;

namespace BlazorApp.Client.Components;
public class Button : ComponentBase
{
    [Parameter] public RenderFragment? ChildContent { get; set; }

    [Parameter]public bool Outline { get; set; }

    [Parameter] public string? Tag { get; set; } = "button";

    protected override void BuildRenderTree(RenderTreeBuilder builder)
    {
        //<button></button>
        builder.OpenElement(0, Tag);
        builder.AddAttribute(1, "class", $"btn btn-{(Outline?"outline-":"")}success");
        builder.AddAttribute(2, "onclick", EventCallback.Factory.Create(this, ()=>{
        
        }));
        builder.AddContent(10, ChildContent);
        builder.CloseElement();
    }
}
